// center.js
Page({
  data: {
    userinfoStor:{},
    userInfo: {
      avatarUrl: '',
      nickName: '',
      email: 'user@example.com'
    },
    quanxian:'',
    completedOrders: 12
  },
  goout(){
    wx.removeStorageSync('userInfoData')
    wx.removeStorageSync('quanxian')
    wx.reLaunch({
      url: '/pages/login/login'
    });
  },
  //跳转到运单列表
  navigateToLishi() {
    wx.navigateTo({
      url: '/pages/lishi/lishi'
    });
  },

   //跳转到车辆管理列表
   navigateToCheLiang() {
    wx.navigateTo({
      url: '/pages/cheliang/cheliang'
    });
  },
   //跳转到车辆管理挂车管理列表
   navigateToGuaChe() {
    wx.navigateTo({
      url: '/pages/guache/guache'
    });
  },
onShow(){
  
},
  onLoad() {
    this.setData({
      userinfoStor: wx.getStorageSync('userInfoData'),
      quanxian:wx.getStorageSync('quanxian')
    })
    this.getUserProfile()
  },
  getUserProfile() {
    wx.getUserProfile({
      desc: '用于完善会员资料',
      success: res => {
        this.setData({
          userInfo: res.userInfo
        });
      }
    });
  },

  navigateToWaybill() {
    wx.navigateTo({
      url: '/pages/order/list'
    });
  },

  navigateToVehicle() {
    wx.navigateTo({
      url: '/pages/map/navigation'
    });
  },

  onClickBack() {
    wx.navigateBack();
  },

  getUserProfile() {
    wx.getUserProfile({
      desc: '用于展示用户信息',
      success: res => {
        this.setData({
          'userInfo.avatarUrl': res.userInfo.avatarUrl,
          'userInfo.nickName': res.userInfo.nickName
        })

      }
    })
  },

  navToOrderList() {
    wx.navigateTo({
      url: '/pages/order/list'
    })
  },

  editVehicle() {
    wx.showToast({
      title: '功能开发中',
      icon: 'none'
    })
  },

  navToSettings() {
    wx.navigateTo({
      url: '/pages/settings/index'
    })
  }
})